package main

import (
	"net"
	"fmt"
)

func main()  {
	//tcpaddr,_:=net.ResolveTCPAddr("tcp",":7527")
	//listener,_:=net.ListenTCP("tcp",tcpaddr)
	listener,_:=net.Listen("tcp",":7527")
	fmt.Println("正在等待客户端连接")
	conn,_:=listener.Accept()
	defer conn.Close()
	for{
		bs:=make([]byte,512)
		n,_:=conn.Read(bs)
		constant:=string(bs[:n])
		if constant=="over"||n==0{
			fmt.Println("客户端已经跑了")
			break
		}
		fmt.Println("客户端说：",constant)
		line:=""
		fmt.Scanln(&line)
		n,_=conn.Write([]byte(line))
	}

}
